package cfl.activemq.com.queues;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * 消息监听
 * @author chenfenli
 *
 */
public class QueuesListener implements MessageListener{

	@Override
	public void onMessage(Message message) {
		if(message != null)
		{
			if(message instanceof TextMessage)
			{
				try {
					TextMessage textMessage = (TextMessage)message;
					System.out.println(textMessage.getText());
				} catch (JMSException e) {
					e.printStackTrace();
				}
			}
		}
	}

}
